package org.example.util;

import io.jsonwebtoken.Claims;

/**
 * @Description
 * @Author chenhs
 * @Date 15:14 2025/7/26
 */
public class TokenGenerator {
    public static void main(String[] args) {
        // 普通用户token
        String userToken = JwtUtil.generateToken("user1", "user");
        System.out.println("User Token: " + userToken);

//        String userToken = "eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoidXNlciIsInN1YiI6InVzZXIxIiwiaWF0IjoxNzUzNTE3MzIwLCJleHAiOjE3NTQzODEzMjB9.xDuDIVECXDcOawUK09Z9fn-0Eyi6MqIFv58j49RFc1s";
//        Claims claims = JwtUtil.parseToken(userToken);
//        System.out.println(claims.getSubject());
//        System.out.println(claims.get("role", String.class));


        // 管理员token
        String adminToken = JwtUtil.generateToken("admin1", "admin");
        System.out.println("Admin Token: " + adminToken);



    }
}
